Skip to content

feat: add bigint column type support and update dependencies#2950

Open
ArnabChatterjee20k wants to merge 9 commits intomainfrom
big-int
Open

feat: add bigint column type support and update dependencies#2950
ArnabChatterjee20k wants to merge 9 commits intomainfrom
big-int

Conversation

@ArnabChatterjee20k
Copy link
Copy Markdown
Member

What does this PR do?

(Provide a description of what this PR does.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 1, 2026

Greptile Summary

This PR adds BigInt column type support to the TablesDB UI — including a new bigint.svelte column form, buildPayload serialization helper that casts bigint fields before SDK calls, and updates to row create/edit/spreadsheet paths. Two issues need attention before merge:

  • min and max are not passed through normalizeBigInt in submitBigInt/updateBigInt, meaning they reach the SDK as JS number while xdefault is correctly normalized to bigint.
  • A console.log({ value }) debug statement was left inside castBigIntValue in rows/store.ts.

Confidence Score: 4/5

Safe to merge after fixing the min/max normalization gap and removing the debug log.

One P1 defect: min and max in submitBigInt/updateBigInt are sent as JS numbers instead of bigints to the API, inconsistent with how xdefault is handled. Combined with the leftover console.log, these should be fixed before merging.

columns/bigint.svelte (normalization) and rows/store.ts (debug log).

Vulnerabilities

No security concerns identified.

Important Files Changed

Filename Overview
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/bigint.svelte New BigInt column form component; min and max are not normalized to bigint before the SDK call (unlike xdefault), which will send JS numbers where the API expects bigints.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/store.ts Adds buildPayload/castBigIntValue to serialize bigint fields before SDK calls; contains a leftover console.log debug statement on line 65.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/+page.svelte Type cast for numeric columns updated to include Models.ColumnBigint; BigInt display logic correctly guarded by typeof min === 'bigint' checks.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/store.ts Registers BigInt column type with correct icon, component, and create/update handlers.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/column.svelte Adds bigint to column union type and routes bigint rendering through the existing Integer component.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte Adds bigint case to parseValue and placeholder helpers, falling through to the existing integer branch.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/create.svelte Integrates buildPayload into prepareRowPayload so bigint fields are serialized correctly on row creation.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/edit.svelte Uses buildPayload before the updateRow SDK call to ensure bigint fields are correctly typed.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/editRelated.svelte Both updateRow call sites updated to use buildPayload for related rows.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/spreadsheet.svelte Applies buildPayload to spreadsheet inline edits and maps bigint columns to the hashtag icon.
src/lib/helpers/faker.ts Adds a bigint case using faker.number.bigInt().toString() for test data generation.
src/lib/helpers/types.ts Adds 'bigint' to the columnTypes constant array.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+layout.svelte Uses buildPayload for bulk row update and create paths in the layout.
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/store.ts Adds Models.ColumnBigint to the Columns union type.

Reviews (5): Last reviewed commit: "updated" | Re-trigger Greptile

Comment on lines +55 to 58
case 'bigint':
case 'integer': {
const int = parseInt(trimmed, 10);
return isNaN(int) ? null : int;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 parseInt silently loses precision for large BigInt values

When column.type === 'bigint', this code falls through to parseInt(trimmed, 10), which returns a JavaScript number. JavaScript number is a 64-bit float with only 53 bits of mantissa, meaning any integer beyond Number.MAX_SAFE_INTEGER (~9×10¹⁵) is silently corrupted.

For example:

parseInt("9007199254740993", 10)  // → 9007199254740992  (wrong, off by 1)

BigInt columns in most databases support 64-bit integers (up to ~9.2×10¹⁸), so real values in the upper range of a bigint column will be silently truncated/rounded when saved through this path.

The correct approach is to use BigInt() for the bigint case:

case 'bigint': {
    try {
        return BigInt(trimmed);
    } catch {
        return null;
    }
}
case 'integer': {
    const int = parseInt(trimmed, 10);
    return isNaN(int) ? null : int;
}

Note that adopting BigInt also requires updating the parseValue return type (number | bigint | boolean | string | null) and ensuring the JSON.stringify comparison in the reactive $effect blocks handles BigInt (since JSON.stringify(BigInt(1)) throws a TypeError).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big int is just a split off from the Integer. Earlier integer only handled bigint with this, now a separate type

- Updated bigint column type handling in the database table columns.
- Refactored input components to use InputText for bigint values with validation.
- Improved parsing and error handling for bigint inputs in string representation.
- Adjusted type definitions to include bigint in various contexts.
- Added bigint type to the Columns type definition.
- Updated bigint input handling in the bigint.svelte component, replacing InputText with InputNumber for better user experience.
- Enhanced data binding and validation for bigint values, including min, max, and default settings.
- Adjusted column value handling in various components to accommodate bigint type.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 9, 2026

Tip:

Greploop — Automatically fix all review issues by running /greploops in Claude Code. It iterates: fix, push, re-review, repeat until 5/5 confidence.

Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal.

tableId: page.params.table,
rowId: row.$id,
data: row
data: buildPayload(columns, row as Record<string, unknown>)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why unknown here instead of a typed row?
Do we not know the shape,
Can't we define a type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants